Autogenerated HTML docs for v1.5.3.4-319-gdd817 
diff --git a/user-manual.html b/user-manual.html index 0cd9d45..ba2206d 100644 --- a/user-manual.html +++ b/user-manual.html 
@@ -1,4 +1,4 @@ -<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Git User's Manual (for version 1.5.3 or newer)</title><link rel="stylesheet" href="docbook-xsl.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.69.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id189136"></a>Git User's Manual (for version 1.5.3 or newer)</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="#id264725">Preface</a></span></dt><dt><span class="chapter"><a href="#repositories-and-branches">1. Repositories and Branches</a></span></dt><dd><dl><dt><span class="section"><a href="#how-to-get-a-git-repository">How to get a git repository</a></span></dt><dt><span class="section"><a href="#how-to-check-out">How to check out a different version of a project</a></span></dt><dt><span class="section"><a href="#understanding-commits">Understanding History: Commits</a></span></dt><dd><dl><dt><span class="section"><a href="#understanding-reachability">Understanding history: commits, parents, and reachability</a></span></dt><dt><span class="section"><a href="#history-diagrams">Understanding history: History diagrams</a></span></dt><dt><span class="section"><a href="#what-is-a-branch">Understanding history: What is a branch?</a></span></dt></dl></dd><dt><span class="section"><a href="#manipulating-branches">Manipulating branches</a></span></dt><dt><span class="section"><a href="#detached-head">Examining an old version without creating a new branch</a></span></dt><dt><span class="section"><a href="#examining-remote-branches">Examining branches from a remote repository</a></span></dt><dt><span class="section"><a href="#how-git-stores-references">Naming branches, tags, and other references</a></span></dt><dt><span class="section"><a href="#Updating-a-repository-with-git-fetch">Updating a repository with git fetch</a></span></dt><dt><span class="section"><a href="#fetching-branches">Fetching branches from other repositories</a></span></dt></dl></dd><dt><span class="chapter"><a href="#exploring-git-history">2. Exploring git history</a></span></dt><dd><dl><dt><span class="section"><a href="#using-bisect">How to use bisect to find a regression</a></span></dt><dt><span class="section"><a href="#naming-commits">Naming commits</a></span></dt><dt><span class="section"><a href="#creating-tags">Creating tags</a></span></dt><dt><span class="section"><a href="#browsing-revisions">Browsing revisions</a></span></dt><dt><span class="section"><a href="#generating-diffs">Generating diffs</a></span></dt><dt><span class="section"><a href="#viewing-old-file-versions">Viewing old file versions</a></span></dt><dt><span class="section"><a href="#history-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#counting-commits-on-a-branch">Counting the number of commits on a branch</a></span></dt><dt><span class="section"><a href="#checking-for-equal-branches">Check whether two branches point at the same history</a></span></dt><dt><span class="section"><a href="#finding-tagged-descendants">Find first tagged version including a given fix</a></span></dt><dt><span class="section"><a href="#showing-commits-unique-to-a-branch">Showing commits unique to a given branch</a></span></dt><dt><span class="section"><a href="#making-a-release">Creating a changelog and tarball for a software release</a></span></dt><dt><span class="section"><a href="#Finding-comments-with-given-content">Finding commits referencing a file with given content</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#Developing-with-git">3. Developing with git</a></span></dt><dd><dl><dt><span class="section"><a href="#telling-git-your-name">Telling git your name</a></span></dt><dt><span class="section"><a href="#creating-a-new-repository">Creating a new repository</a></span></dt><dt><span class="section"><a href="#how-to-make-a-commit">How to make a commit</a></span></dt><dt><span class="section"><a href="#creating-good-commit-messages">Creating good commit messages</a></span></dt><dt><span class="section"><a href="#ignoring-files">Ignoring files</a></span></dt><dt><span class="section"><a href="#how-to-merge">How to merge</a></span></dt><dt><span class="section"><a href="#resolving-a-merge">Resolving a merge</a></span></dt><dd><dl><dt><span class="section"><a href="#conflict-resolution">Getting conflict-resolution help during a merge</a></span></dt></dl></dd><dt><span class="section"><a href="#undoing-a-merge">Undoing a merge</a></span></dt><dt><span class="section"><a href="#fast-forwards">Fast-forward merges</a></span></dt><dt><span class="section"><a href="#fixing-mistakes">Fixing mistakes</a></span></dt><dd><dl><dt><span class="section"><a href="#reverting-a-commit">Fixing a mistake with a new commit</a></span></dt><dt><span class="section"><a href="#fixing-a-mistake-by-editing-history">Fixing a mistake by editing history</a></span></dt><dt><span class="section"><a href="#checkout-of-path">Checking out an old version of a file</a></span></dt><dt><span class="section"><a href="#interrupted-work">Temporarily setting aside work in progress</a></span></dt></dl></dd><dt><span class="section"><a href="#ensuring-good-performance">Ensuring good performance</a></span></dt><dt><span class="section"><a href="#ensuring-reliability">Ensuring reliability</a></span></dt><dd><dl><dt><span class="section"><a href="#checking-for-corruption">Checking the repository for corruption</a></span></dt><dt><span class="section"><a href="#recovering-lost-changes">Recovering lost changes</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#sharing-development">4. Sharing development with others</a></span></dt><dd><dl><dt><span class="section"><a href="#getting-updates-with-git-pull">Getting updates with git pull</a></span></dt><dt><span class="section"><a href="#submitting-patches">Submitting patches to a project</a></span></dt><dt><span class="section"><a href="#importing-patches">Importing patches to a project</a></span></dt><dt><span class="section"><a href="#public-repositories">Public git repositories</a></span></dt><dd><dl><dt><span class="section"><a href="#setting-up-a-public-repository">Setting up a public repository</a></span></dt><dt><span class="section"><a href="#exporting-via-git">Exporting a git repository via the git protocol</a></span></dt><dt><span class="section"><a href="#exporting-via-http">Exporting a git repository via http</a></span></dt><dt><span class="section"><a href="#pushing-changes-to-a-public-repository">Pushing changes to a public repository</a></span></dt><dt><span class="section"><a href="#setting-up-a-shared-repository">Setting up a shared repository</a></span></dt><dt><span class="section"><a href="#setting-up-gitweb">Allowing web browsing of a repository</a></span></dt></dl></dd><dt><span class="section"><a href="#sharing-development-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#maintaining-topic-branches">Maintaining topic branches for a Linux subsystem maintainer</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#cleaning-up-history">5. Rewriting history and maintaining patch series</a></span></dt><dd><dl><dt><span class="section"><a href="#patch-series">Creating the perfect patch series</a></span></dt><dt><span class="section"><a href="#using-git-rebase">Keeping a patch series up to date using git-rebase</a></span></dt><dt><span class="section"><a href="#modifying-one-commit">Modifying a single commit</a></span></dt><dt><span class="section"><a href="#reordering-patch-series">Reordering or selecting from a patch series</a></span></dt><dt><span class="section"><a href="#patch-series-tools">Other tools</a></span></dt><dt><span class="section"><a href="#problems-with-rewriting-history">Problems with rewriting history</a></span></dt></dl></dd><dt><span class="chapter"><a href="#advanced-branch-management">6. Advanced branch management</a></span></dt><dd><dl><dt><span class="section"><a href="#fetching-individual-branches">Fetching individual branches</a></span></dt><dt><span class="section"><a href="#fetch-fast-forwards">git fetch and fast-forwards</a></span></dt><dt><span class="section"><a href="#forcing-fetch">Forcing git fetch to do non-fast-forward updates</a></span></dt><dt><span class="section"><a href="#remote-branch-configuration">Configuring remote branches</a></span></dt></dl></dd><dt><span class="chapter"><a href="#git-concepts">7. Git concepts</a></span></dt><dd><dl><dt><span class="section"><a href="#the-object-database">The Object Database</a></span></dt><dd><dl><dt><span class="section"><a href="#commit-object">Commit Object</a></span></dt><dt><span class="section"><a href="#tree-object">Tree Object</a></span></dt><dt><span class="section"><a href="#blob-object">Blob Object</a></span></dt><dt><span class="section"><a href="#trust">Trust</a></span></dt><dt><span class="section"><a href="#tag-object">Tag Object</a></span></dt><dt><span class="section"><a href="#pack-files">How git stores objects efficiently: pack files</a></span></dt><dt><span class="section"><a href="#dangling-objects">Dangling objects</a></span></dt></dl></dd><dt><span class="section"><a href="#the-index">The index</a></span></dt></dl></dd><dt><span class="chapter"><a href="#submodules">8. Submodules</a></span></dt><dd><dl><dt><span class="section"><a href="#id279699">Pitfalls with submodules</a></span></dt></dl></dd><dt><span class="chapter"><a href="#low-level-operations">9. Low-level git operations</a></span></dt><dd><dl><dt><span class="section"><a href="#object-manipulation">Object access and manipulation</a></span></dt><dt><span class="section"><a href="#the-workflow">The Workflow</a></span></dt><dd><dl><dt><span class="section"><a href="#working-directory-to-index">working directory -&gt; index</a></span></dt><dt><span class="section"><a href="#index-to-object-database">index -&gt; object database</a></span></dt><dt><span class="section"><a href="#object-database-to-index">object database -&gt; index</a></span></dt><dt><span class="section"><a href="#index-to-working-directory">index -&gt; working directory</a></span></dt><dt><span class="section"><a href="#tying-it-all-together">Tying it all together</a></span></dt></dl></dd><dt><span class="section"><a href="#examining-the-data">Examining the data</a></span></dt><dt><span class="section"><a href="#merging-multiple-trees">Merging multiple trees</a></span></dt><dt><span class="section"><a href="#merging-multiple-trees-2">Merging multiple trees, continued</a></span></dt></dl></dd><dt><span class="chapter"><a href="#hacking-git">10. Hacking git</a></span></dt><dd><dl><dt><span class="section"><a href="#object-details">Object storage format</a></span></dt><dt><span class="section"><a href="#birdview-on-the-source-code">A birds-eye view of Git's source code</a></span></dt></dl></dd><dt><span class="chapter"><a href="#glossary">11. GIT Glossary</a></span></dt><dt><span class="appendix"><a href="#git-quick-start">A. Git Quick Reference</a></span></dt><dd><dl><dt><span class="section"><a href="#quick-creating-a-new-repository">Creating a new repository</a></span></dt><dt><span class="section"><a href="#managing-branches">Managing branches</a></span></dt><dt><span class="section"><a href="#exploring-history">Exploring history</a></span></dt><dt><span class="section"><a href="#making-changes">Making changes</a></span></dt><dt><span class="section"><a href="#merging">Merging</a></span></dt><dt><span class="section"><a href="#sharing-your-changes">Sharing your changes</a></span></dt><dt><span class="section"><a href="#repository-maintenance">Repository maintenance</a></span></dt></dl></dd><dt><span class="appendix"><a href="#todo">B. Notes and todo list for this manual</a></span></dt></dl></div><div class="preface" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id264725"></a>Preface</h2></div></div></div><p>Git is a fast distributed revision control system.</p><p>This manual is designed to be readable by someone with basic UNIX +<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Git User's Manual (for version 1.5.3 or newer)</title><link rel="stylesheet" href="docbook-xsl.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.69.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id189136"></a>Git User's Manual (for version 1.5.3 or newer)</h1></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="#id264725">Preface</a></span></dt><dt><span class="chapter"><a href="#repositories-and-branches">1. Repositories and Branches</a></span></dt><dd><dl><dt><span class="section"><a href="#how-to-get-a-git-repository">How to get a git repository</a></span></dt><dt><span class="section"><a href="#how-to-check-out">How to check out a different version of a project</a></span></dt><dt><span class="section"><a href="#understanding-commits">Understanding History: Commits</a></span></dt><dd><dl><dt><span class="section"><a href="#understanding-reachability">Understanding history: commits, parents, and reachability</a></span></dt><dt><span class="section"><a href="#history-diagrams">Understanding history: History diagrams</a></span></dt><dt><span class="section"><a href="#what-is-a-branch">Understanding history: What is a branch?</a></span></dt></dl></dd><dt><span class="section"><a href="#manipulating-branches">Manipulating branches</a></span></dt><dt><span class="section"><a href="#detached-head">Examining an old version without creating a new branch</a></span></dt><dt><span class="section"><a href="#examining-remote-branches">Examining branches from a remote repository</a></span></dt><dt><span class="section"><a href="#how-git-stores-references">Naming branches, tags, and other references</a></span></dt><dt><span class="section"><a href="#Updating-a-repository-with-git-fetch">Updating a repository with git fetch</a></span></dt><dt><span class="section"><a href="#fetching-branches">Fetching branches from other repositories</a></span></dt></dl></dd><dt><span class="chapter"><a href="#exploring-git-history">2. Exploring git history</a></span></dt><dd><dl><dt><span class="section"><a href="#using-bisect">How to use bisect to find a regression</a></span></dt><dt><span class="section"><a href="#naming-commits">Naming commits</a></span></dt><dt><span class="section"><a href="#creating-tags">Creating tags</a></span></dt><dt><span class="section"><a href="#browsing-revisions">Browsing revisions</a></span></dt><dt><span class="section"><a href="#generating-diffs">Generating diffs</a></span></dt><dt><span class="section"><a href="#viewing-old-file-versions">Viewing old file versions</a></span></dt><dt><span class="section"><a href="#history-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#counting-commits-on-a-branch">Counting the number of commits on a branch</a></span></dt><dt><span class="section"><a href="#checking-for-equal-branches">Check whether two branches point at the same history</a></span></dt><dt><span class="section"><a href="#finding-tagged-descendants">Find first tagged version including a given fix</a></span></dt><dt><span class="section"><a href="#showing-commits-unique-to-a-branch">Showing commits unique to a given branch</a></span></dt><dt><span class="section"><a href="#making-a-release">Creating a changelog and tarball for a software release</a></span></dt><dt><span class="section"><a href="#Finding-comments-with-given-content">Finding commits referencing a file with given content</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#Developing-with-git">3. Developing with git</a></span></dt><dd><dl><dt><span class="section"><a href="#telling-git-your-name">Telling git your name</a></span></dt><dt><span class="section"><a href="#creating-a-new-repository">Creating a new repository</a></span></dt><dt><span class="section"><a href="#how-to-make-a-commit">How to make a commit</a></span></dt><dt><span class="section"><a href="#creating-good-commit-messages">Creating good commit messages</a></span></dt><dt><span class="section"><a href="#ignoring-files">Ignoring files</a></span></dt><dt><span class="section"><a href="#how-to-merge">How to merge</a></span></dt><dt><span class="section"><a href="#resolving-a-merge">Resolving a merge</a></span></dt><dd><dl><dt><span class="section"><a href="#conflict-resolution">Getting conflict-resolution help during a merge</a></span></dt></dl></dd><dt><span class="section"><a href="#undoing-a-merge">Undoing a merge</a></span></dt><dt><span class="section"><a href="#fast-forwards">Fast-forward merges</a></span></dt><dt><span class="section"><a href="#fixing-mistakes">Fixing mistakes</a></span></dt><dd><dl><dt><span class="section"><a href="#reverting-a-commit">Fixing a mistake with a new commit</a></span></dt><dt><span class="section"><a href="#fixing-a-mistake-by-editing-history">Fixing a mistake by editing history</a></span></dt><dt><span class="section"><a href="#checkout-of-path">Checking out an old version of a file</a></span></dt><dt><span class="section"><a href="#interrupted-work">Temporarily setting aside work in progress</a></span></dt></dl></dd><dt><span class="section"><a href="#ensuring-good-performance">Ensuring good performance</a></span></dt><dt><span class="section"><a href="#ensuring-reliability">Ensuring reliability</a></span></dt><dd><dl><dt><span class="section"><a href="#checking-for-corruption">Checking the repository for corruption</a></span></dt><dt><span class="section"><a href="#recovering-lost-changes">Recovering lost changes</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#sharing-development">4. Sharing development with others</a></span></dt><dd><dl><dt><span class="section"><a href="#getting-updates-with-git-pull">Getting updates with git pull</a></span></dt><dt><span class="section"><a href="#submitting-patches">Submitting patches to a project</a></span></dt><dt><span class="section"><a href="#importing-patches">Importing patches to a project</a></span></dt><dt><span class="section"><a href="#public-repositories">Public git repositories</a></span></dt><dd><dl><dt><span class="section"><a href="#setting-up-a-public-repository">Setting up a public repository</a></span></dt><dt><span class="section"><a href="#exporting-via-git">Exporting a git repository via the git protocol</a></span></dt><dt><span class="section"><a href="#exporting-via-http">Exporting a git repository via http</a></span></dt><dt><span class="section"><a href="#pushing-changes-to-a-public-repository">Pushing changes to a public repository</a></span></dt><dt><span class="section"><a href="#setting-up-a-shared-repository">Setting up a shared repository</a></span></dt><dt><span class="section"><a href="#setting-up-gitweb">Allowing web browsing of a repository</a></span></dt></dl></dd><dt><span class="section"><a href="#sharing-development-examples">Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#maintaining-topic-branches">Maintaining topic branches for a Linux subsystem maintainer</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#cleaning-up-history">5. Rewriting history and maintaining patch series</a></span></dt><dd><dl><dt><span class="section"><a href="#patch-series">Creating the perfect patch series</a></span></dt><dt><span class="section"><a href="#using-git-rebase">Keeping a patch series up to date using git-rebase</a></span></dt><dt><span class="section"><a href="#modifying-one-commit">Modifying a single commit</a></span></dt><dt><span class="section"><a href="#reordering-patch-series">Reordering or selecting from a patch series</a></span></dt><dt><span class="section"><a href="#patch-series-tools">Other tools</a></span></dt><dt><span class="section"><a href="#problems-with-rewriting-history">Problems with rewriting history</a></span></dt></dl></dd><dt><span class="chapter"><a href="#advanced-branch-management">6. Advanced branch management</a></span></dt><dd><dl><dt><span class="section"><a href="#fetching-individual-branches">Fetching individual branches</a></span></dt><dt><span class="section"><a href="#fetch-fast-forwards">git fetch and fast-forwards</a></span></dt><dt><span class="section"><a href="#forcing-fetch">Forcing git fetch to do non-fast-forward updates</a></span></dt><dt><span class="section"><a href="#remote-branch-configuration">Configuring remote branches</a></span></dt></dl></dd><dt><span class="chapter"><a href="#git-concepts">7. Git concepts</a></span></dt><dd><dl><dt><span class="section"><a href="#the-object-database">The Object Database</a></span></dt><dd><dl><dt><span class="section"><a href="#commit-object">Commit Object</a></span></dt><dt><span class="section"><a href="#tree-object">Tree Object</a></span></dt><dt><span class="section"><a href="#blob-object">Blob Object</a></span></dt><dt><span class="section"><a href="#trust">Trust</a></span></dt><dt><span class="section"><a href="#tag-object">Tag Object</a></span></dt><dt><span class="section"><a href="#pack-files">How git stores objects efficiently: pack files</a></span></dt><dt><span class="section"><a href="#dangling-objects">Dangling objects</a></span></dt></dl></dd><dt><span class="section"><a href="#the-index">The index</a></span></dt></dl></dd><dt><span class="chapter"><a href="#submodules">8. Submodules</a></span></dt><dd><dl><dt><span class="section"><a href="#id279798">Pitfalls with submodules</a></span></dt></dl></dd><dt><span class="chapter"><a href="#low-level-operations">9. Low-level git operations</a></span></dt><dd><dl><dt><span class="section"><a href="#object-manipulation">Object access and manipulation</a></span></dt><dt><span class="section"><a href="#the-workflow">The Workflow</a></span></dt><dd><dl><dt><span class="section"><a href="#working-directory-to-index">working directory -&gt; index</a></span></dt><dt><span class="section"><a href="#index-to-object-database">index -&gt; object database</a></span></dt><dt><span class="section"><a href="#object-database-to-index">object database -&gt; index</a></span></dt><dt><span class="section"><a href="#index-to-working-directory">index -&gt; working directory</a></span></dt><dt><span class="section"><a href="#tying-it-all-together">Tying it all together</a></span></dt></dl></dd><dt><span class="section"><a href="#examining-the-data">Examining the data</a></span></dt><dt><span class="section"><a href="#merging-multiple-trees">Merging multiple trees</a></span></dt><dt><span class="section"><a href="#merging-multiple-trees-2">Merging multiple trees, continued</a></span></dt></dl></dd><dt><span class="chapter"><a href="#hacking-git">10. Hacking git</a></span></dt><dd><dl><dt><span class="section"><a href="#object-details">Object storage format</a></span></dt><dt><span class="section"><a href="#birdview-on-the-source-code">A birds-eye view of Git's source code</a></span></dt></dl></dd><dt><span class="chapter"><a href="#glossary">11. GIT Glossary</a></span></dt><dt><span class="appendix"><a href="#git-quick-start">A. Git Quick Reference</a></span></dt><dd><dl><dt><span class="section"><a href="#quick-creating-a-new-repository">Creating a new repository</a></span></dt><dt><span class="section"><a href="#managing-branches">Managing branches</a></span></dt><dt><span class="section"><a href="#exploring-history">Exploring history</a></span></dt><dt><span class="section"><a href="#making-changes">Making changes</a></span></dt><dt><span class="section"><a href="#merging">Merging</a></span></dt><dt><span class="section"><a href="#sharing-your-changes">Sharing your changes</a></span></dt><dt><span class="section"><a href="#repository-maintenance">Repository maintenance</a></span></dt></dl></dd><dt><span class="appendix"><a href="#todo">B. Notes and todo list for this manual</a></span></dt></dl></div><div class="preface" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="id264725"></a>Preface</h2></div></div></div><p>Git is a fast distributed revision control system.</p><p>This manual is designed to be readable by someone with basic UNIX  command-line skills, but no previous knowledge of git.</p><p><a href="#repositories-and-branches" title="Chapter 1. Repositories and Branches">Chapter 1, <i>Repositories and Branches</i></a> and <a href="#exploring-git-history" title="Chapter 2. Exploring git history">Chapter 2, <i>Exploring git history</i></a> explain how  to fetch and study a project using git—read these chapters to learn how  to build and test a particular version of a software project, search for @@ -383,7 +383,7 @@  echo "git diff --stat --summary -M v$last v$new &gt; ../diffstat-$new"</p></div><p>and then he just cut-and-pastes the output commands after verifying that  they look OK.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="Finding-comments-with-given-content"></a>Finding commits referencing a file with given content</h3></div></div></div><p>Somebody hands you a copy of a file, and asks which commits modified a  file such that it contained the given content either before or after the -commit. You can find out with this:</p><div class="literallayout"><p>$  git log --raw --abbrev=40 --pretty=oneline -- filename |<br> +commit. You can find out with this:</p><div class="literallayout"><p>$  git log --raw --abbrev=40 --pretty=oneline |<br>          grep -B 1 `git hash-object filename`</p></div><p>Figuring out why this works is left as an exercise to the (advanced)  student. The <a href="git-log.html" target="_top">git-log(1)</a>, <a href="git-diff-tree.html" target="_top">git-diff-tree(1)</a>, and  <a href="git-hash-object.html" target="_top">git-hash-object(1)</a> man pages may prove helpful.</p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="Developing-with-git"></a>Chapter 3. Developing with git</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#telling-git-your-name">Telling git your name</a></span></dt><dt><span class="section"><a href="#creating-a-new-repository">Creating a new repository</a></span></dt><dt><span class="section"><a href="#how-to-make-a-commit">How to make a commit</a></span></dt><dt><span class="section"><a href="#creating-good-commit-messages">Creating good commit messages</a></span></dt><dt><span class="section"><a href="#ignoring-files">Ignoring files</a></span></dt><dt><span class="section"><a href="#how-to-merge">How to merge</a></span></dt><dt><span class="section"><a href="#resolving-a-merge">Resolving a merge</a></span></dt><dd><dl><dt><span class="section"><a href="#conflict-resolution">Getting conflict-resolution help during a merge</a></span></dt></dl></dd><dt><span class="section"><a href="#undoing-a-merge">Undoing a merge</a></span></dt><dt><span class="section"><a href="#fast-forwards">Fast-forward merges</a></span></dt><dt><span class="section"><a href="#fixing-mistakes">Fixing mistakes</a></span></dt><dd><dl><dt><span class="section"><a href="#reverting-a-commit">Fixing a mistake with a new commit</a></span></dt><dt><span class="section"><a href="#fixing-a-mistake-by-editing-history">Fixing a mistake by editing history</a></span></dt><dt><span class="section"><a href="#checkout-of-path">Checking out an old version of a file</a></span></dt><dt><span class="section"><a href="#interrupted-work">Temporarily setting aside work in progress</a></span></dt></dl></dd><dt><span class="section"><a href="#ensuring-good-performance">Ensuring good performance</a></span></dt><dt><span class="section"><a href="#ensuring-reliability">Ensuring reliability</a></span></dt><dd><dl><dt><span class="section"><a href="#checking-for-corruption">Checking the repository for corruption</a></span></dt><dt><span class="section"><a href="#recovering-lost-changes">Recovering lost changes</a></span></dt></dl></dd></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="telling-git-your-name"></a>Telling git your name</h2></div></div></div><p>Before creating any commits, you should introduce yourself to git. The @@ -593,7 +593,7 @@  current branch. Then you can make your fix as usual.</p><div class="literallayout"><p>... edit and test ...<br>  $ git commit -a -m "blorpl: typofix"</p></div><p>After that, you can go back to what you were working on with  <code class="literal">git stash apply</code>:</p><div class="literallayout"><p>$ git stash apply</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ensuring-good-performance"></a>Ensuring good performance</h2></div></div></div><p>On large repositories, git depends on compression to keep the history -information from taking up to much space on disk or in memory.</p><p>This compression is not performed automatically. Therefore you +information from taking up too much space on disk or in memory.</p><p>This compression is not performed automatically. Therefore you  should occasionally run <a href="git-gc.html" target="_top">git-gc(1)</a>:</p><div class="literallayout"><p>$ git gc</p></div><p>to recompress the archive. This can be very time-consuming, so  you may prefer to run git-gc when you are not doing other work.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ensuring-reliability"></a>Ensuring reliability</h2></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="checking-for-corruption"></a>Checking the repository for corruption</h3></div></div></div><p>The <a href="git-fsck.html" target="_top">git-fsck(1)</a> command runs a number of self-consistency checks  on the repository, and reports on any problems. This may take some @@ -609,10 +609,10 @@  ...</p></div><p>Dangling objects are not a problem. At worst they may take up a little  extra disk space. They can sometimes provide a last-resort method for  recovering lost work—see <a href="#dangling-objects" title="Dangling objects">the section called “Dangling objects”</a> for details. However, if -you wish, you can remove them with <a href="git-prune.html" target="_top">git-prune(1)</a> or the —prune +you wish, you can remove them with <a href="git-prune.html" target="_top">git-prune(1)</a> or the <code class="literal">—prune</code>  option to <a href="git-gc.html" target="_top">git-gc(1)</a>:</p><div class="literallayout"><p>$ git gc --prune</p></div><p>This may be time-consuming. Unlike most other git operations (including  git-gc when run without any options), it is not safe to prune while -other git operations are in progress in the same repository.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="recovering-lost-changes"></a>Recovering lost changes</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="reflogs"></a>Reflogs</h4></div></div></div><p>Say you modify a branch with <a href="git-reset.html" target="_top">git-reset(1)</a> —hard, and then +other git operations are in progress in the same repository.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="recovering-lost-changes"></a>Recovering lost changes</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="reflogs"></a>Reflogs</h4></div></div></div><p>Say you modify a branch with <code class="literal"><a href="git-reset.html" target="_top">git-reset(1)</a> —hard</code>, and then  realize that the branch was the only reference you had to that point in  history.</p><p>Fortunately, git also keeps a log, called a "reflog", of all the  previous values of each branch. So in this case you can still find the @@ -659,7 +659,7 @@  accomplish the above with just a simple</p><div class="literallayout"><p>$ git pull</p></div><p>More generally, a branch that is created from a remote branch will pull  by default from that branch. See the descriptions of the  branch.&lt;name&gt;.remote and branch.&lt;name&gt;.merge options in -<a href="git-config.html" target="_top">git-config(1)</a>, and the discussion of the —track option in +<a href="git-config.html" target="_top">git-config(1)</a>, and the discussion of the <code class="literal">—track</code> option in  <a href="git-checkout.html" target="_top">git-checkout(1)</a>, to learn how to control these defaults.</p><p>In addition to saving you keystrokes, "git pull" also helps you by  producing a default commit message documenting the branch and  repository that you pulled from.</p><p>(But note that no such commit will be created in the case of a @@ -692,7 +692,7 @@  you can just pull changes from each other's repositories directly;  commands that accept repository URLs as arguments will also accept a  local directory name:</p><div class="literallayout"><p>$ git clone /path/to/repository<br> -$ git pull /path/to/other/repository</p></div><p>or an ssh url:</p><div class="literallayout"><p>$ git clone ssh://yourhost/~you/repository</p></div><p>For projects with few developers, or for synchronizing a few private +$ git pull /path/to/other/repository</p></div><p>or an ssh URL:</p><div class="literallayout"><p>$ git clone ssh://yourhost/~you/repository</p></div><p>For projects with few developers, or for synchronizing a few private  repositories, this may be all you need.</p><p>However, the more common way to do this is to maintain a separate public  repository (usually on a different host) for others to pull changes  from. This is usually more convenient, and allows you to cleanly @@ -717,7 +717,7 @@  around it.</p><p>Next, copy proj.git to the server where you plan to host the  public repository. You can use scp, rsync, or whatever is most  convenient.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="exporting-via-git"></a>Exporting a git repository via the git protocol</h3></div></div></div><p>This is the preferred method.</p><p>If someone else administers the server, they should tell you what -directory to put the repository in, and what git:// url it will appear +directory to put the repository in, and what git:// URL it will appear  at. You can then skip to the section  "<a href="#pushing-changes-to-a-public-repository" title="Pushing changes to a public repository">Pushing changes to a public repository</a>", below.</p><p>Otherwise, all you need to do is start <a href="git-daemon.html" target="_top">git-daemon(1)</a>; it will  listen on port 9418. By default, it will allow access to any directory @@ -733,8 +733,8 @@  $ git --bare update-server-info<br>  $ chmod a+x hooks/post-update</p></div><p>(For an explanation of the last two lines, see  <a href="git-update-server-info.html" target="_top">git-update-server-info(1)</a>, and the documentation -<a href="hooks.html" target="_top">Hooks used by git</a>.)</p><p>Advertise the url of proj.git. Anybody else should then be able to -clone or pull from that url, for example with a command line like:</p><div class="literallayout"><p>$ git clone http://yourserver.com/~you/proj.git</p></div><p>(See also +<a href="hooks.html" target="_top">Hooks used by git</a>.)</p><p>Advertise the URL of proj.git. Anybody else should then be able to +clone or pull from that URL, for example with a command line like:</p><div class="literallayout"><p>$ git clone http://yourserver.com/~you/proj.git</p></div><p>(See also  <a href="howto/setup-git-server-over-http.txt" target="_top">setup-git-server-over-http</a>  for a slightly more sophisticated setup using WebDAV which also  allows pushing over http.)</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="pushing-changes-to-a-public-repository"></a>Pushing changes to a public repository</h3></div></div></div><p>Note that the two techniques outlined above (exporting via @@ -747,7 +747,7 @@  a <a href="#fast-forwards" title="Fast-forward merges">fast forward</a>. Normally this is a sign of  something wrong. However, if you are sure you know what you're  doing, you may force git-push to perform the update anyway by -proceeding the branch name by a plus sign:</p><div class="literallayout"><p>$ git push ssh://yourserver.com/~you/proj.git +master</p></div><p>Note that the target of a "push" is normally a +preceding the branch name by a plus sign:</p><div class="literallayout"><p>$ git push ssh://yourserver.com/~you/proj.git +master</p></div><p>Note that the target of a "push" is normally a  <a href="#def_bare_repository">bare</a> repository. You can also push to a  repository that has a checked-out working tree, but the working tree  will not be updated by the push. This may lead to unexpected results if @@ -805,7 +805,7 @@  at the current tip of origin/master branch, and should be set up (using  the —track option to <a href="git-branch.html" target="_top">git-branch(1)</a>) to merge changes in from  Linus by default.</p><div class="literallayout"><p>$ git branch --track test origin/master<br> -$ git branch --track release origin/master</p></div><p>These can be easily kept up to date using <a href="git-pull.html" target="_top">git-pull(1)</a></p><div class="literallayout"><p>$ git checkout test &amp;&amp; git pull<br> +$ git branch --track release origin/master</p></div><p>These can be easily kept up to date using <a href="git-pull.html" target="_top">git-pull(1)</a>.</p><div class="literallayout"><p>$ git checkout test &amp;&amp; git pull<br>  $ git checkout release &amp;&amp; git pull</p></div><p>Important note! If you have any local changes in these branches, then  this merge will create a commit object in the history (with no local  changes git will simply do a "Fast forward" merge). Many people dislike @@ -833,11 +833,11 @@  means that the patches can be moved into the "release" tree in any order.</p><div class="literallayout"><p>$ git checkout release &amp;&amp; git pull . speed-up-spinlocks</p></div><p>After a while, you will have a number of branches, and despite the  well chosen names you picked for each of them, you may forget what  they are for, or what status they are in. To get a reminder of what -changes are in a specific branch, use:</p><div class="literallayout"><p>$ git log linux..branchname | git-shortlog</p></div><p>To see whether it has already been merged into the test or release branches -use:</p><div class="literallayout"><p>$ git log test..branchname</p></div><p>or</p><div class="literallayout"><p>$ git log release..branchname</p></div><p>(If this branch has not yet been merged you will see some log entries. +changes are in a specific branch, use:</p><div class="literallayout"><p>$ git log linux..branchname | git-shortlog</p></div><p>To see whether it has already been merged into the test or release branches, +use:</p><div class="literallayout"><p>$ git log test..branchname</p></div><p>or</p><div class="literallayout"><p>$ git log release..branchname</p></div><p>(If this branch has not yet been merged, you will see some log entries.  If it has been merged, then there will be no output.)</p><p>Once a patch completes the great cycle (moving from test to release,  then pulled by Linus, and finally coming back into your local -"origin/master" branch) the branch for this change is no longer needed. +"origin/master" branch), the branch for this change is no longer needed.  You detect this when the output from:</p><div class="literallayout"><p>$ git log origin..branchname</p></div><p>is empty. At this point the branch can be deleted:</p><div class="literallayout"><p>$ git branch -d branchname</p></div><p>Some changes are so trivial that it is not necessary to create a separate  branch and then merge into each of the test and release branches. For  these changes, just apply directly to the "release" branch, and then @@ -987,7 +987,7 @@  a'--b'--c' &lt;-- mywork</pre><p>In the process, it may discover conflicts. In that case it will stop  and allow you to fix the conflicts; after fixing conflicts, use "git  add" to update the index with those contents, and then, instead of -running git-commit, just run</p><div class="literallayout"><p>$ git rebase --continue</p></div><p>and git will continue applying the rest of the patches.</p><p>At any point you may use the —abort option to abort this process and +running git-commit, just run</p><div class="literallayout"><p>$ git rebase --continue</p></div><p>and git will continue applying the rest of the patches.</p><p>At any point you may use the <code class="literal">—abort</code> option to abort this process and  return mywork to the state it had before you started the rebase:</p><div class="literallayout"><p>$ git rebase --abort</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="modifying-one-commit"></a>Modifying a single commit</h2></div></div></div><p>We saw in <a href="#fixing-a-mistake-by-editing-history" title="Fixing a mistake by editing history">the section called “Fixing a mistake by editing history”</a> that you can replace the  most recent commit using</p><div class="literallayout"><p>$ git commit --amend</p></div><p>which will replace the old commit by a new commit incorporating your  changes, giving you a chance to edit the old commit message first.</p><p>You can also use a combination of this and <a href="git-rebase.html" target="_top">git-rebase(1)</a> to edit @@ -1004,9 +1004,9 @@  allows you to apply the change introduced by that commit and create a  new commit that records it. So, for example, if "mywork" points to a  series of patches on top of "origin", you might do something like:</p><div class="literallayout"><p>$ git checkout -b mywork-new origin<br> -$ gitk origin..mywork &amp;</p></div><p>And browse through the list of patches in the mywork branch using gitk, +$ gitk origin..mywork &amp;</p></div><p>and browse through the list of patches in the mywork branch using gitk,  applying them (possibly in a different order) to mywork-new using -cherry-pick, and possibly modifying them as you go using commit —amend. +cherry-pick, and possibly modifying them as you go using <code class="literal">commit —amend</code>.  The <a href="git-gui.html" target="_top">git-gui(1)</a> command may also help as it allows you to  individually select diff hunks for inclusion in the index (by  right-clicking on the diff hunk and choosing "Stage Hunk for Commit").</p><p>Another technique is to use git-format-patch to create a series of @@ -1094,7 +1094,7 @@  Git can quickly determine whether two objects are identical or not,  just by comparing names.  </li><li> -Since object names are computed the same way in ever repository, the +Since object names are computed the same way in every repository, the  same content stored in two repositories will always be stored under  the same name.  </li><li> @@ -1110,7 +1110,7 @@  can refer to other tree objects, thus creating a directory hierarchy.  </li><li>  A <a href="#def_commit_object">"commit" object</a> ties such directory hierarchies - together into a <a href="#def_DAG">directed acyclic graph</a> of revisions - each + together into a <a href="#def_DAG">directed acyclic graph</a> of revisions—each  commit contains the object name of exactly one tree designating the  directory hierarchy at the time of the commit. In addition, a commit  refers to "parent" commit objects that describe the history of how we @@ -1263,7 +1263,7 @@  example, a "dangling blob" may arise because you did a "git add" of a  file, but then, before you actually committed it and made it part of the  bigger picture, you changed something else in that file and committed -that <span class="strong"><strong>updated</strong></span> thing - the old state that you added originally ends up +that <span class="strong"><strong>updated</strong></span> thing—the old state that you added originally ends up  not being pointed to by any commit or tree, so it's now a dangling blob  object.</p><p>Similarly, when the "recursive" merge strategy runs, and finds that  there are criss-cross merges and thus more than one merge base (which is @@ -1274,7 +1274,7 @@  up pointing to them, so they end up "dangling" in your repository.</p><p>Generally, dangling objects aren't anything to worry about. They can  even be very useful: if you screw something up, the dangling objects can  be how you recover your old tree (say, you did a rebase, and realized -that you really didn't want to - you can look at what dangling objects +that you really didn't want to—you can look at what dangling objects  you have, and decide to reset your head to some old dangling state).</p><p>For commits, you can just use:</p><div class="literallayout"><p>$ gitk &lt;dangling-commit-sha-goes-here&gt; --not --all</p></div><p>This asks for all the history reachable from the given commit but not  from any branch, tag, or other reference. If you decide it's something  you want, you can always create a new reference to it, e.g.,</p><div class="literallayout"><p>$ git branch recovered-branch &lt;dangling-commit-sha-goes-here&gt;</p></div><p>For blobs and trees, you can't do the same, but you can still examine @@ -1288,8 +1288,8 @@  leaving _some_ of the new objects in the object database, but just  dangling and useless.</p><p>Anyway, once you are sure that you're not interested in any dangling  state, you can just prune all unreachable objects:</p><div class="literallayout"><p>$ git prune</p></div><p>and they'll be gone. But you should only run "git prune" on a quiescent -repository - it's kind of like doing a filesystem fsck recovery: you -don't want to do that while the filesystem is mounted.</p><p>(The same is true of "git-fsck" itself, btw - but since +repository—it's kind of like doing a filesystem fsck recovery: you +don't want to do that while the filesystem is mounted.</p><p>(The same is true of "git-fsck" itself, btw, but since  git-fsck never actually <span class="strong"><strong>changes</strong></span> the repository, it just reports  on what it found, git-fsck itself is never "dangerous" to run.  Running it while somebody is actually changing the repository can cause @@ -1332,7 +1332,7 @@  number, and will take on values other than 0 for files with merge  conflicts.</p></li></ol></div><p>The index is thus a sort of temporary staging area, which is filled with  a tree which you are in the process of working on.</p><p>If you blow the index away entirely, you generally haven't lost any -information as long as you have the name of the tree that it described.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="submodules"></a>Chapter 8. Submodules</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id279699">Pitfalls with submodules</a></span></dt></dl></div><p>Large projects are often composed of smaller, self-contained modules. For +information as long as you have the name of the tree that it described.</p></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="submodules"></a>Chapter 8. Submodules</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#id279798">Pitfalls with submodules</a></span></dt></dl></div><p>Large projects are often composed of smaller, self-contained modules. For  example, an embedded Linux distribution's source tree would include every  piece of software in the distribution with some local modifications; a movie  player might need to build against a specific, known-working version of a @@ -1426,7 +1426,7 @@  $ git add a<br>  $ git commit -m "Updated submodule a."<br>  $ git push</p></div><p>You have to run <code class="literal">git submodule update</code> after <code class="literal">git pull</code> if you want to update -submodules, too.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id279699"></a>Pitfalls with submodules</h2></div></div></div><p>Always publish the submodule change before publishing the change to the +submodules, too.</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id279798"></a>Pitfalls with submodules</h2></div></div></div><p>Always publish the submodule change before publishing the change to the  superproject that references it. If you forget to publish the submodule change,  others won't be able to clone the repository:</p><div class="literallayout"><p>$ cd ~/git/super/a<br>  $ echo i added another line to this file &gt;&gt; a.txt<br> @@ -1462,9 +1462,10 @@  <a href="git-diff-tree.html" target="_top">git-diff-tree(1)</a>.</p><p>A tag is created with <a href="git-mktag.html" target="_top">git-mktag(1)</a>, and the signature can be  verified by <a href="git-verify-tag.html" target="_top">git-verify-tag(1)</a>, though it is normally simpler to  use <a href="git-tag.html" target="_top">git-tag(1)</a> for both.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="the-workflow"></a>The Workflow</h2></div></div></div><p>High-level operations such as <a href="git-commit.html" target="_top">git-commit(1)</a>, -<a href="git-checkout.html" target="_top">git-checkout(1)</a> and git-reset[1] work by moving data between the -working tree, the index, and the object database. Git provides -low-level operations which perform each of these steps individually.</p><p>Generally, all "git" operations work on the index file. Some operations +<a href="git-checkout.html" target="_top">git-checkout(1)</a> and <a href="git-reset.html" target="_top">git-reset(1)</a> work by moving data +between the working tree, the index, and the object database. Git +provides low-level operations which perform each of these steps +individually.</p><p>Generally, all "git" operations work on the index file. Some operations  work <span class="strong"><strong>purely</strong></span> on the index file (showing the current state of the  index), but most operations move data between the index file and either  the database or the working directory. Thus there are four main @@ -1485,12 +1486,12 @@  stat information. It will <span class="emphasis"><em>not</em></span> update the object status itself, and  it will only update the fields that are used to quickly test whether  an object still matches its old backing store object.</p><p>The previously introduced <a href="git-add.html" target="_top">git-add(1)</a> is just a wrapper for -<a href="git-update-index.html" target="_top">git-update-index(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="index-to-object-database"></a>index -&gt; object database</h3></div></div></div><p>You write your current index file to a "tree" object with the program</p><div class="literallayout"><p>$ git write-tree</p></div><p>that doesn't come with any options - it will just write out the +<a href="git-update-index.html" target="_top">git-update-index(1)</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="index-to-object-database"></a>index -&gt; object database</h3></div></div></div><p>You write your current index file to a "tree" object with the program</p><div class="literallayout"><p>$ git write-tree</p></div><p>that doesn't come with any options—it will just write out the  current index into the set of tree objects that describe that state,  and it will return the name of the resulting top-level tree. You can  use that tree to re-generate the index at any time by going in the  other direction:</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="object-database-to-index"></a>object database -&gt; index</h3></div></div></div><p>You read a "tree" file from the object database, and use that to -populate (and overwrite - don't do this if your index contains any +populate (and overwrite—don't do this if your index contains any  unsaved state that you might want to restore later!) your current  index. Normal operation is just</p><div class="literallayout"><p>$ git-read-tree &lt;sha1 of tree&gt;</p></div><p>and your index file will now be equivalent to the tree that you saved  earlier. However, that is only your <span class="emphasis"><em>index</em></span> file: your working @@ -1507,7 +1508,7 @@  <span class="emphasis"><em>force</em></span> the checkout.</p><p>Finally, there are a few odds and ends which are not purely moving  from one representation to the other:</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="tying-it-all-together"></a>Tying it all together</h3></div></div></div><p>To commit a tree you have instantiated with "git-write-tree", you'd  create a "commit" object that refers to that tree and the history -behind it - most notably the "parent" commits that preceded it in +behind it—most notably the "parent" commits that preceded it in  history.</p><p>Normally a "commit" has one parent: the previous state of the tree  before a certain change was made. However, sometimes it can have two  or more parent commits, in which case we call it a "merge", due to the @@ -1579,12 +1580,12 @@  tree, aka the common tree, and the two "result" trees, aka the branches  you want to merge), you do a "merge" read into the index. This will  complain if it has to throw away your old index contents, so you should -make sure that you've committed those - in fact you would normally +make sure that you've committed those—in fact you would normally  always do a merge against your last commit (which should thus match what  you have in your current index anyway).</p><p>To do the merge, do</p><div class="literallayout"><p>$ git-read-tree -m -u &lt;origtree&gt; &lt;yourtree&gt; &lt;targettree&gt;</p></div><p>which will do all trivial merge operations for you directly in the  index file, and you can just write the result out with  <code class="literal">git-write-tree</code>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="merging-multiple-trees-2"></a>Merging multiple trees, continued</h2></div></div></div><p>Sadly, many merges aren't trivial. If there are files that have -been added.moved or removed, or if both branches have modified the +been added, moved or removed, or if both branches have modified the  same file, you will be left with an index tree that contains "merge  entries" in it. Such an index tree can <span class="emphasis"><em>NOT</em></span> be written out to a tree  object, and you will have to resolve any such merge clashes using @@ -1715,7 +1716,7 @@  repository, it writes the resulting SHA-1 into the variable <code class="literal">sha1</code>.</p><p>Two things are interesting here:</p><div class="itemizedlist"><ul type="disc"><li>  <code class="literal">get_sha1()</code> returns 0 on _success_. This might surprise some new  Git hackers, but there is a long tradition in UNIX to return different - negative numbers in case of different errors — and 0 on success. + negative numbers in case of different errors—and 0 on success.  </li><li>  the variable <code class="literal">sha1</code> in the function signature of <code class="literal">get_sha1()</code> is <code class="literal">unsigned  char *</code>, but is actually expected to be a pointer to <code class="literal">unsigned @@ -1797,8 +1798,8 @@  </span></dt><dd>  In <a href="#def_SCM">SCM</a> jargon, "cherry pick" means to choose a subset of  changes out of a series of changes (typically commits) and record them - as a new series of changes on top of different codebase. In GIT, this is - performed by "git cherry-pick" command to extract the change introduced + as a new series of changes on top of a different codebase. In GIT, this is + performed by the "git cherry-pick" command to extract the change introduced  by an existing <a href="#def_commit">commit</a> and to record it based on the tip  of the current <a href="#def_branch">branch</a> as a new commit.  </dd><dt><span class="term"> @@ -2058,7 +2059,7 @@  </span></dt><dd>  The term <a href="#def_pickaxe">pickaxe</a> refers to an option to the diffcore  routines that help select changes that add or delete a given text - string. With the —pickaxe-all option, it can be used to view the full + string. With the <code class="literal">—pickaxe-all</code> option, it can be used to view the full  <a href="#def_changeset">changeset</a> that introduced or removed, say, a  particular line of text. See <a href="git-diff.html" target="_top">git-diff(1)</a>.  </dd><dt><span class="term"> @@ -2082,8 +2083,8 @@  </span></dt><dd>  Pushing a <a href="#def_branch">branch</a> means to get the branch's  <a href="#def_head_ref">head ref</a> from a remote <a href="#def_repository">repository</a>, - find out if it is an ancestor to the branch's local - head ref is a direct, and in that case, putting all + find out if it is a direct ancestor to the branch's local + head ref, and in that case, putting all  objects, which are <a href="#def_reachable">reachable</a> from the local  head ref, and which are missing from the remote  repository, into the remote @@ -2133,7 +2134,7 @@  it as my origin branch head". And <code class="literal">git push  $URL refs/heads/master:refs/heads/to-upstream</code> means "publish my  master branch head as to-upstream branch at $URL". See also - <a href="git-push.html" target="_top">git-push(1)</a> + <a href="git-push.html" target="_top">git-push(1)</a>.  </dd><dt><span class="term">  <a name="def_repository"></a>repository  </span></dt><dd> @@ -2263,7 +2264,7 @@  $ cd project</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="managing-branches"></a>Managing branches</h2></div></div></div><div class="literallayout"><p>$ git branch         # list all local branches in this repo<br>  $ git checkout test  # switch working directory to branch "test"<br>  $ git branch new     # create branch "new" starting at current HEAD<br> -$ git branch -d new  # delete branch "new"</p></div><p>Instead of basing new branch on current HEAD (the default), use:</p><div class="literallayout"><p>$ git branch new test    # branch named "test"<br> +$ git branch -d new  # delete branch "new"</p></div><p>Instead of basing a new branch on current HEAD (the default), use:</p><div class="literallayout"><p>$ git branch new test    # branch named "test"<br>  $ git branch new v2.6.15 # tag named v2.6.15<br>  $ git branch new HEAD^   # commit before the most recent<br>  $ git branch new HEAD^^  # commit before that<br>